









<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>sindice4j - Using Sindice4J</title>
    <link rel="stylesheet" href="./css/maven-theme.css" type="text/css" />
    <link rel="stylesheet" href="./css/maven-base.css" type="text/css"/>
    <link rel="stylesheet" href="./css/prettify.css" type="text/css"/>
    <link rel="stylesheet" href="./css/print.css" type="text/css" media="print" />
    <script type="text/javascript" src="./js/prettify.js"></script>
    <script type="text/javascript" src="./js/niftycube.js"></script>
    <script type="text/javascript">
        window.onload=function() {
            Nifty("div\#wrapper", "big");
            Nifty("div#breadcrumbs", "small");
            Nifty("div\#navcolumn", "small");
            Nifty("div.source", "medium");
            prettyPrint();
        }
    </script>
          <meta name="author" content="Sindice4J" />
        <meta name="Date-Revision-yyyymmdd" content="20110711" />
      </head>
  <body>
    <div id="wrapper">
        <div id="banner">
                      <a href="" id="bannerLeft"  >
    
                                            <img src="images/sindice-logo.png" alt="sindice4j" />
    
            </a>
                            <div class="clear">
            <hr/>
          </div>
        </div>
        <div id="breadcrumbs">
              
  

  
    
            
  
    
            <div class="xleft">
        <span id="publishDate">Last Published: 2011-07-11</span>
                  &nbsp;| <span id="projectVersion">Version: 0.4</span>
                      </div>
                <div class="xright">      
  

  
    
            
  
    
  </div>
          <div class="clear">
            <hr/>
          </div>
        </div>
        <div id="leftColumn">
          <div id="navcolumn">
               
  

  
    
            
  
    
                       <h5>sindice4j</h5>
            <ul>
              
    <li class="none">
                    <a href="index.html">Introduction</a>
          </li>
              
    <li class="none">
              <strong>Using Sindice4J</strong>
        </li>
          </ul>
              <h5>Project Documentation</h5>
            <ul>
              
                
                    
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
              
        <li class="collapsed">
                    <a href="project-info.html">Project Information</a>
                </li>
              
                
                    
                  
                  
              
        <li class="collapsed">
                    <a href="project-reports.html">Project Reports</a>
                </li>
          </ul>
              <h5>External Links</h5>
            <ul>
              
    <li class="none">
                    <a href="http://sindice.com/" class="externalLink">sindice.com</a>
          </li>
          </ul>
                                               <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
            <img class="poweredBy"
                 alt="Built by Maven"
                 src="./images/logos/maven-feather.png"
                 width="90"
                 height="30"
                 border="1" />
          </a>
                           
  

  
    
            
  
    
            </div>
        </div>
        <div id="bodyColumn">
          <div id="contentBox">
            <div class="section"><h2>Using Sindice4J<a name="Using_Sindice4J"></a></h2><p>The <tt>com.sindice.Sindice</tt> client is the core application class; to obtain an instance, just use instantiate it:</p><div class="source"><pre>import com.sindice.*;

Sindice sindice = new Sindice();</pre></div><div class="section"><h3>Perform a Term Search<a name="Perform_a_Term_Search"></a></h3><p>To perform a term search use the <tt>sindice</tt> object instance as shown in the following snippet:</p><div class="source"><pre>import com.sindice.*;

SearchResults searchResults = sindice.termSearch(&quot;Berners-Lee&quot;);
for(SearchResult searchResult : searchResults) {
    System.out.println(searchResult.getTitle());
    ...
    System.out.println(searchResult.getLink());
}</pre></div></div><div class="section"><h3>Perform an Advanced Search<a name="Perform_an_Advanced_Search"></a></h3><p>Alternatively you can perform an advanced query by specifying a property and a value:</p><div class="source"><pre>import com.sindice.*;

SearchResults searchResults = sindice.advancedSearch(
    &quot;foaf:name&quot;,
        &quot;Renaud Delbru&quot;
);
for(SearchResult searchResult : searchResults) {
    System.out.println(searchResult.getTitle());
    ...
    System.out.println(searchResult.getLink());
}               </pre></div></div><div class="section"><h3>Access the Sindice Cache<a name="Access_the_Sindice_Cache"></a></h3><p>It is possible to retrieve content from the <tt>Sindice Cache</tt> as shown in the following code snippet:</p><div class="source"><pre>CacheQuery query = new CacheQuery(
     &quot;http://www.michelemostarda.com/foaf.rdf&quot;
);
CacheResult cacheResult = sindice.cacheQuery(query);
System.out.println( cacheResult.getExplicitContent()[0] );
...</pre></div></div></div>
          </div>
        </div>
        <div class="clear">
          <hr/>
        </div>
        <div id="footer">
          <div class="xright">Copyright &#169;         
   
          2010-2011.
    
      All Rights Reserved.    
  

  
    
            
  
    
  </div>
          <div class="clear">
            <hr/>
          </div>
        </div>
    </div>
  </body>
</html>
